//一级目录联动二级目录
function findLevelTwo(data,form,$) {
    var parentId = data.value;

    var content="<option value=''>请选择二级分类</option>";

    if(parentId == null||parentId == ""){

        $("#levelTwo").html(content);
        $("#levelThree").html("<option value=''>请选择三级分类</option>");
        form.render('select');
        return;
    }

    $.getJSON(
        baseUrl+"dev/app/typeLevel",
        {parentId:parentId},
        function (result) {
            if (result.code==0){

                var jsonArrays = result.data;

                for (var i = 0;i<jsonArrays.length;i++){
                    content+="<option value='"+jsonArrays[i].id+"'>"+jsonArrays[i].categoryName+"</option>"
                }
                $("#levelThree").html("<option value=''>请选择三级分类</option>");
                $("#levelTwo").html(content);
                form.render('select');
            }else {
                layer.msg(result.msg);
            }
        }
    )
}

//二级目录联动三级目录
function findLevelThree(data,form,$) {
    var parentId = data.value;

    var content="<option value=''>请选择三级分类</option>";

    if(parentId == null||parentId == ""){

        $("#levelThree").html(content);

        form.render('select');
        return;
    }

    $.getJSON(
        baseUrl+"dev/app/typeLevel",
        {parentId:parentId},
        function (result) {
            if (result.code==0){

                var jsonArrays = result.data;

                for (var i = 0;i<jsonArrays.length;i++){
                    content+="<option value='"+jsonArrays[i].id+"'>"+jsonArrays[i].categoryName+"</option>"
                }

                $("#levelThree").html(content);
                form.render('select');
            }else {
                layer.msg(result.msg);
            }
        }
    )


}